package cz.zcu.fav.rat.dataaccess.service;

import java.util.List;

import org.springframework.security.access.annotation.Secured;
import org.springframework.transaction.annotation.Transactional;

import cz.zcu.fav.rat.beans.User;
import cz.zcu.fav.rat.beans.Object;

import cz.zcu.fav.rat.dataaccess.dao.GenericDAO;

public interface UserService extends GenericDataAccessService<User, GenericDAO<User, Integer>>
{

	List<User> findBySurname(String name);
	
	List<User> findByNickname(String nickname);
	
	List<User> findByNicknameAndImplementor(String nickname, String implementor);
	
	void addNewFavouriteToUser(User user, Object object);
	
	void removeFavouriteToUser(User user, Object obj);
	
	boolean isObjectUsersFavourite(Integer userId, Integer objectId);
	@Override
	@Transactional(readOnly = false)
    @Secured("ROLE_ADMIN")
	void delete(User persistentObject);
	
	@Override
	@Transactional(readOnly = false)
    @Secured("ROLE_ADMIN")
	Integer create(User newInstance);

}
